#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define NUM_THREADS 1
typedef struct stru
{
    int x1;
    int y1;
    int x2;
    int y2;
}stru;
void *jisuan(void *t) {
    stru* st=(stru*)t;
    st->x1=st->x1+st->x2;
    st->y1=st->y1+st->y2;
    return st;
}

int main(int argc, char *argv[]) {
    pthread_t thread[NUM_THREADS];
    pthread_attr_t attr;
    int rc;
    long t;
    void *status;
    stru st;
    st.x1=1;
    st.x2=3;
    st.y1=5;
    st.y2=7;

    pthread_attr_init(&attr);
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
    rc = pthread_create(&thread[0], &attr, jisuan, (void *) &st);
    if (rc) {
        printf("ERROR; return code from pthread_create() is % d\n", rc);
        exit(-1);
    }

pthread_attr_destroy(&attr);
rc = pthread_join(thread[0], &status);
if (rc) {
    printf("ERROR; return code from pthread_join() is % d\n", rc);
    exit(-1);
}
stru* ret=(stru*)status;
printf("i is:%d ,j is %d",ret->x1,ret->y1);

printf("Main: program completed. Exiting.\n");
pthread_exit(NULL);
}

